package com.atqh.logistics.controller.Driver;

import com.atqh.logistics.Aop.LogAnnotation;
import com.atqh.logistics.service.DriverService;
import com.atqh.logistics.service.RequestsService;
import com.atqh.logistics.utils.Result;
import com.atqh.logistics.utils.Vo.params.LoginParam;
import com.atqh.logistics.utils.Vo.params.RequestParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @作者：大叔azhe
 * @api：详细描述
 * @创建时间：19:03 2023/4/11
 */
@Api(tags = "司机功能模块")
@RestController
@CrossOrigin
@RequestMapping("/driver")
public class DriverController {
    @Autowired
    private DriverService driverService;

    @Autowired
    private RequestsService requestsService;

    @ApiOperation("查看司机个人信息")
    @RequestMapping("/information")
    @LogAnnotation(module = "司机模块", operator = "查看个人信息")
    public Result GetInfo(HttpServletRequest request) {
        return driverService.getOwnInfo(request);
    }

    @ApiOperation("查看司机查看个人任务")
    @RequestMapping("/getOwnTask")
    @LogAnnotation(module = "司机模块", operator = "查看个人任务")
    public Result GetOwnTask(HttpServletRequest req) {
        return driverService.getOwnTask(req);
    }

    @ApiOperation("更新司机当前个人任务完成状态")
    @RequestMapping("/updateTask/{mid}")
    @LogAnnotation(module = "司机模块", operator = "更新当前个人任务完成状态")
    public Result UpdateOwnTask(@PathVariable("mid")int missionId) {
        return driverService.UpdateOwnTask(missionId);
    }

    @ApiOperation("查看公告")
    @RequestMapping("/viewnotice")
    @LogAnnotation(module = "司机模块", operator = "查看公告")
    public Result ViewNotice() {
        return driverService.ViewNotice();
    }

    @ApiOperation("司机提交申请")
    @RequestMapping("/requests")
    @LogAnnotation(module = "司机模块", operator = "提交申请")
    public Result Request(@RequestBody RequestParam requestParam, HttpServletRequest req) {
        return requestsService.Request(requestParam,req);
    }

}
